Parse.initialize("VIQrHTVbjbq5YOnpiNv7gyS8B0RfPVSrLtkv0xeU", "Rp6zTUUdjzMWkjkb1uEZJ32TD0kCzCpMQInke8CN");

function login() {
    var username = document.getElementById("username").value;
    var password = document.getElementById("password").value;

    Parse.User.logIn(username, password, {
        success: function (user) {
            window.location = "";
        },
        error: function (user, error) {
            console.log("Error: " + error.code + " " + error.message);
        }
    });

    
}

function register() {
	var username = document.getElementById("usernameA").value;
    var password = document.getElementById("passwordA").value;
    var passRepeat = document.getElementById("passRep").value;
    var email = document.getElementById("email").value;

    if (password == passRepeat) {
        var user = new Parse.User();
        user.set("username", username);
        user.set("password", password);
        user.set("email", email);

        user.signUp(null, {
            success: function (user) {
                alert("Congrats! Now you can start the coding experience");
                window.location = "index.html";
            },
            error: function (user, error) {
                console.log("Error: " + error.code + " " + error.message);
            }
        });
    }

    
}